<div class="game-main">
  <div id="bet-game">
  <div class="beet-box-bg" style="display: none;width:100%;height:100%;position: fixed;top: 0;left: 0;z-index:99">
  <div class="beet-tips"> 
     <?php
		if($_COOKIE['mode']){
			$mode=$_COOKIE['mode'];
		}else{
			$mode=2.00;
		}
		$this->getSystemSettings();
		$this->getTypes();
		$sql="select id, groupName, enable from {$this->prename}played_group where enable=1 and type=? order by sort";
		$groups=$this->getObject($sql, 'id', $this->types[$this->type]['type']);
		if($this->groupId && !$groups[$this->groupId]) unset($this->groupId);
	
		if($groups) foreach($groups as $key=>$group){
			if($this->groupId==$group['id']){
			echo '<div style="margin-bottom:1em;"><div class="beet-tips-tit"><span id="play_title">'.$group['groupName'].'</span></div></div>';
			}
		}
	?>
	<div class="clear"></div>
    <div class="game-btn">

	<?php
		if($groups) foreach($groups as $key=>$group){
			if(!$this->groupId) $this->groupId=$group['id'];
	?>
	   <span onclick="window.location.href='/index.php/index/game/<?=$this->type?>/<?=$group['id']?>'">
      <div class="ul-li<?=($this->groupId==$group['id'])?' current':''?>"> <a class="cai" href="/index.php/index/group/<?=$this->type .'/'.$group['id']?>"><span class="contentXXXX">
        <?=$group['groupName']?>
        </span></a> </div></span>
      <?php } ?>
	  
		<div class="clear"></div>
    </div>
    .
	
	<!--inc_game_played S-->
	<?php
		$sql="select groupName from {$this->prename}played_group where id=?";
		$groupName=$this->getValue($sql, $this->groupId);

		$sql="select id, name, playedTpl, enable  from {$this->prename}played where enable=1 and groupId=? order by sort";
		$playeds=$this->getRows($sql, $this->groupId);
		if(!$playeds) {echo '<div style="height:150px;margin-top:50px;text-align:center;color:#f00">暂无玩法</div>';return;} 
		if(!$this->played) $this->played=$playeds[0]['id'];
		
		if($playeds) foreach($playeds as $played){
			if($played['id']==$this->played){
				echo '<div style="margin-bottom:2em;"><div class="beet-tips-tit"><span id="play_title2">'.$played['name'].'</span></div></div>';
			}
		}
		
	?>
	    <div class="game-cont">
			<div class="game-btn2">
				<?php
					if($playeds) foreach($playeds as $played){
						if($this->played==$played['id']){
							$tpl=$played['playedTpl'];
						}
						if($played['enable']){
				?>
				<div class="ul-li<?=($played['id']==$this->played)?' current':''?>"><a data_id="<?=$played['id']?>" href="/index.php/index/played/<?=$this->type?>/<?=$played['id']?>"><?=$played['name']?></a></div>
				<?php }} ?>
				<div class="clear"></div>
			</div>
		</div>
	</div>
	</div><!--beet-box-bg end-->
	<!--inc_game_played E-->
    <div class="game-cont">
	
	<!--inc_game_played S-->
	

	<div class="num-table" id="num-select">
	<?php 
		if(!$played['enable']) {echo '<div style="height:100px;text-align:center;color:#f00">暂无玩法</div>';return;} 
		
		$this->display("index/game-played/$tpl.php"); ?>
	</div>
	<!--inc_game_played E-->

	
<script type="text/javascript">

	$(function(){
		
		domAction();
		
		$('.bett-top-box').bind('touchend', function () {
			event.preventDefault();
			
			$('.beet-box-bg').toggle();
			$('.beet-rig').hide();
		});
		
		/* $('.ui-betting-title').click(function(){
        	 if($('.beet-box-bg').css('display')=='none'){
			    $('.beet-box-bg').show();
			 }else{
			    $('.beet-box-bg').hide();
			 }
        })*/
          
		$('.bett-head').click(function(){
			$('.beet-box-bg').hide();
			$('.beet-rig').toggle();
			return false;
		});
		
		$('.beet-box-bg').bind("click",function(e){
			//console.log($(this).css('display'));
			if($(this).css('display')!='none'){
				//event.stopPropagation();
				
			}
			if($(e.target).attr("class")=="beet-box-bg"){
				//alert($(e.target).attr("class"));
				$(this).hide();
			}
			
		});
		
		$(".game-btn2 .ul-li a").live("click",function(){
			//alert(6);
			$('.beet-box-bg').hide();
		});
		
		
		$("#reveal-left").click(function(){
			window.location.href="/index.php";
		});
		
		
		$("#touzhuBox .danwei label>input[type='radio']").live("click",function(){
			$("#touzhuBox .danwei label").removeClass("checked22");
			$(this).parent("label").addClass("checked22");
		});
		
		$("#wei-shu label>input[type='checkbox']").live("click",function(){
			$(this).parent("label").toggleClass("checked23");
		});
		
		

	});
	
	
	function hideDOM(){
		$('.beet-box-bg').hide();
	}
	
	
	function domAction(){
		
		//节点操作
		$(".num-table .pp .title").wrap("<div class=\"lot-number-left\"></div>");
		$(".num-table .pp>input.code").wrap("<div class=\"specific-cell-o\"></div>");
		
		$(".num-table .pp").wrapInner("<div class=\"lot-number-right\"></div>");
		var _titDom;
		$(".num-table .pp .lot-number-right").each(function(){
			//$(".num-table .pp .specific-cell-o").wrapAll("<div class=\"lot-number-right\"></div>");
			
				$(this).find(".clearfix").remove();
				_titDom = $(this).children(".lot-number-left:first");
				_titDom.remove();
				//alert(_titDom);
				$(this).before(_titDom);
				
			if($(this).prev(".lot-number-left").text()==""){
				$(this).css("width","100%");
			}
			
			
		});
		

		
	}
</script>


